home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD Classic 39
/
CD CLASSIC #39 (1998).iso
/
EXTRA
/
RUNTIME
/
UNZ51X.ZIP
/
UNZIP.DOC
< prev
next >
Wrap
Text File
|
1994-02-06
|
19KB
|
396 lines
UNZIP(1L) LOCAL USER COMMANDS UNZIP(1L)
NAME
unzip - list, test and extract compressed files in a ZIP
archive
SYNOPSIS
unzip [-Z] [-cflptuvz[ajnoqsUV$]] file[.zip] [file(s) ...]
[-x xfile(s) ...] [-d exdir]
DESCRIPTION
unzip will list, test, or extract files from a ZIP archive,
commonly found on MS-DOS systems. The default behavior
(with no options) is to extract into the current directory
(and subdirectories below it) all files from the specified
ZIP archive. A companion program, zip(1L), creates ZIP
archives; both programs are compatible with PKWARE's PKZIP
and PKUNZIP for MS-DOS.
ARGUMENTS
file[.zip]
Path of the ZIP archive(s). If the file specification
is a wildcard, each matching file is processed in an
order determined by the operating system (or file sys-
tem). Only the filename can be a wildcard; the path
itself cannot. Wildcard expressions are similar to
Unix egrep(1) (regular) expressions and may contain:
* matches a sequence of 0 or more characters
? matches exactly 1 character
[...]
matches any single character found inside the
brackets; ranges are specified by a beginning
character, a hyphen, and an ending character. If
an exclamation point or a caret (`!' or `^') fol-
lows the left bracket, then the range of charac-
ters within the brackets is complemented (that is,
anything except the characters inside the brackets
is considered a match).
(Be sure to quote any character which might otherwise
be interpreted or modified by the operating system,
particularly under Unix and VMS.) If no matches are
found, the specification is assumed to be a literal
filename; and if that also fails, the suffix .zip is
appended. Note that self-extracting ZIP files are sup-
ported; just specify the .exe suffix (if any) expli-
citly.
[file(s)]
An optional list of archive members to be processed.
Regular expressions (wildcards) may be used to match
multiple members; see above. Again, be sure to quote
expressions that would otherwise be expanded or modi-
fied by the operating system.
[-x xfile(s)]
An optional list of archive members to be excluded from
processing. Since wildcard characters match directory
separators (`/'), this option may be used to exclude
any files which are in subdirectories. For example,
``unzip foo *.[ch] -x */*'' would extract all C source
files in the main directory, but none in any subdirec-
tories. Without the -x option, all C source files in
all directories within the zipfile would be extracted.
[-d exdir]
An optional directory to which to extract files. By
default, all files and subdirectories are recreated in
the current directory; the -d option allows extraction
in an arbitrary directory (always assuming one has per-
mission to write to the directory). This option need
not appear at the end of the command line; it is also
accepted immediately after the zipfile specification,
or between the file(s) and the -x option.
OPTIONS
-Z zipinfo(1) mode. If the first option on the command
line is -Z, the remaining options are taken to be
zipinfo(1) options. See the appropriate manual page
for a description of these options.
-c extract files to stdout/screen (``CRT''). This option
is similar to the -p option except that the name of
each file is printed as it is extracted, the -a option
is allowed, and ASCII-EBCDIC conversion is automati-
cally performed if appropriate.
-f freshen existing files, i.e., extract only those files
which already exist on disk and which are newer than
the disk copies. By default unzip queries before
overwriting, but the -o option may be used to suppress
the queries.
-l list archive files (short format). The name,
uncompressed file size and modification date and time
of each specified file is printed, along with totals
for all files specified. If a file was archived from a
single-case file system (for example, the MS-DOS FAT
file system) and the -U option was not given, the
filename is converted to lowercase and is prefixed with
a caret (^). In addition, the archive comment and
individual file comments (if any) are displayed.
-p extract files to pipe (stdout). Nothing but the file
data is sent to stdout, and the files are always
extracted in binary format, just as they are stored (no
conversions).
-t test archive files. This option extracts each speci-
fied file in memory and compares the CRC (cyclic redun-
dancy check, an enhanced checksum) of the expanded file
with the original file's stored CRC value.
-u update existing files and create new ones if needed.
This option performs the same function as the -f
option, extracting (with query) files which are newer
than those with the same name on disk, and in addition
it extracts those files which do not already exist on
disk.
-v list archive files (verbose format). In addition to
the information given by the -l option, the compression
method, compressed size, compression ratio and 32-bit
CRC is listed.
-z display only the archive comment.
MODIFIERS
-a convert text files. Ordinarily all files are extracted
exactly as they are stored (as ``binary'' files). The
-a option causes files identified by zip as text files
(those with the `t' label in zipinfo listings, rather
than `b') to be automatically extracted as such, con-
verting line endings, end-of-file characters and the
character set itself as necessary. (For example, Unix
files use line feeds (LFs) for end-of-line (EOL) and
have no end-of-file (EOF) marker; Macintoshes use car-
riage returns (CRs) for EOLs; and most PC operating
systems use CR+LF for EOLs and control-Z for EOF. In
addition, IBM mainframes and the Michigan Terminal Sys-
tem use EBCDIC rather than the more common ASCII char-
acter set, and NT supports Unicode.) Note that zip's
identification of text files is by no means perfect;
some ``text'' files may actually be binary and vice
versa. unzip therefore prints ``[text]'' or
``[binary]'' as a visual check for each file it
extracts when using the -a option. The -aa option
forces all files to be extracted as text, regardless of
the supposed file type.
-j junk paths. The archive's directory structure is not
recreated; all files are deposited in the extraction
directory (by default, the current one).
-n never overwrite existing files. If a file already
exists, skip the extraction of that file without
prompting. By default unzip queries before extracting
any file which already exists; the user may choose to
overwrite only the current file, overwrite all files,
skip extraction of the current file, skip extraction of
all existing files, or rename the current file.
-o overwrite existing files without prompting. This is a
dangerous option, so use it with care. (It is often
used with -f, however.)
-q perform operations quietly (-qq = even quieter). Ordi-
narily unzip prints the names of the files it's
extracting or testing, the extraction methods, any file
or zipfile comments which may be stored in the archive,
and possibly a summary when finished with each archive.
The -q[q] options suppress the printing of some or all
of these messages.
-s [OS/2, NT, MS-DOS] convert spaces in filenames to
underscores. Since all PC operating systems allow
spaces in filenames, unzip by default extracts
filenames with spaces intact (e.g., ``EA DATA. SF'').
This can be awkward, however, since MS-DOS in particu-
lar does not gracefully support spaces in filenames.
Conversion of spaces to underscores can eliminate the
awkwardness in some cases.
-U leave filenames uppercase if created under MS-DOS, VMS,
etc. Depending on the archiver, files archived under
single-case filesystems may be stored as all-uppercase
names; this can be awkward when extracting to a case-
preserving filesystem such as OS/2 HPFS or a case-
sensitive one such as under Unix. By default unzip
converts such filenames to lowercase; this option
causes all filenames to be extracted exactly as they're
stored (excepting truncation, conversion of unsupported
characters, etc.).
-V retain (VMS) file version numbers. VMS files can be
stored with a version number, in the format
file.ext;##. By default the ``;##'' version numbers
are stripped, but this option allows them to be
retained. (On filesystems which limit filenames to
particularly short lengths, the version numbers may be
truncated or stripped regardless of this option.)
-X [VMS] restore owner/protection info (may require system
privileges). Ordinary file attributes are always
restored, but this option allows UICs to be restored as
well. [The next version of unzip will support Unix
UID/GID info as well, and possibly NT permissions.]
-$ [MS-DOS, OS/2, NT, Amiga] restore the volume label if
the extraction medium is removable (e.g., a diskette).
Doubling the option (-$$) allows fixed media (hard
disks) to be labelled as well. By default, volume
labels are ignored.
ENVIRONMENT OPTIONS
unzip's default behavior may be modified via options placed
in an environment variable. This can be done with any
option, but it is probably most useful with the -q, -a, -o,
or -n modifiers: make unzip quieter by default, make it
auto-convert text files, or make it always overwrite or
never overwrite files as it extracts them. For example, to
make unzip act as quietly as possible, only reporting
errors, one would use one of the following commands:
UNZIP=-qq; export UNZIP Unix Bourne shell
setenv UNZIP -qq Unix C shell
set UNZIP=-qq OS/2 or MS-DOS
define UNZIP_OPTS "-qq" VMS (quotes for lowercase)
Environment options are, in effect, considered to be just
like any other command-line options, except that they are
effectively the first options on the command line. To over-
ride an environment option, one may use the ``minus opera-
tor'' to remove it. For instance, to override one of the
quiet-flags in the example above, use the command
unzip --q[other options] zipfile
The first hyphen is the normal switch character, and the
second is a minus sign, acting on the q option. Thus the
effect here is to cancel one quantum of quietness. To can-
cel both quiet flags, two (or more) minuses may be used:
unzip -t--q zipfile
unzip ---qt zipfile
(the two are equivalent). This may seem awkward or confus-
ing, but it is reasonably intuitive: just ignore the first
hyphen and go from there. It is also consistent with the
behavior of Unix nice(1).
EXAMPLES
To use unzip to extract all members of the archive
letters.zip into the current directory and subdirectories
below it, creating any subdirectories as necessary:
unzip letters
To extract all members of letters.zip into the current
directory only:
unzip -j letters
To test letters.zip, printing only a summary message indi-
cating whether the archive is OK or not:
unzip -tq letters
To extract to standard output all members of letters.zip
whose names end in .tex, auto-converting to the local end-
of-line convention and piping the output into more(1):
unzip -ca letters \*.tex | more
(The backslash before the asterisk is only required if the
shell expands wildcards, as in Unix; double quotes could
have been used instead, as in the source example below.) To
extract the binary file paper1.dvi to standard output and
pipe it to a printing program:
unzip -p articles paper1.dvi | dvips
To extract all FORTRAN and C source files--*.f, *.c, *.h,
and Makefile--into the /tmp directory:
unzip source.zip "*.[fch]" Makefile -d /tmp
(the double quotes are necessary only in Unix and only if
globbing is turned on). To extract only newer versions of
the files already in the current directory, without querying
(NOTE: be careful of unzipping in one timezone a zipfile
created in another--ZIP archives to date contain no timezone
information, and a ``newer'' file from an eastern timezone
may, in fact, be older):
unzip -fo sources
To extract newer versions of the files already in the
current directory and to create any files not already there
(same caveat as previous example):
unzip -uo sources
In the last five examples, assume that UNZIP or UNZIP_OPTS
is set to -q. To do a singly quiet listing:
unzip -l file
To do a doubly quiet listing:
unzip -ql file
To do a standard listing:
unzip --ql file
or
unzip -l-q file
or
unzip -l--q file (extra minuses don't hurt)
TIPS
The current maintainer, being a lazy sort, finds it very
useful to define a pair of aliases: tt for ``unzip -tq''
and ii for ``unzip -Z'' (or ``zipinfo''). One may then sim-
ply type ``tt zipfile'' to test an archive, something which
is worth making a habit of doing. With luck unzip will
report ``No errors detected in zipfile.zip,'' after which
one may breathe a sigh of relief.
BUGS
[MS-DOS] When extracting or testing files from an archive on
a defective floppy diskette, if the ``Fail'' option is
chosen from DOS's ``Abort, Retry, Fail?'' message, unzip may
hang the system, requiring a reboot. Instead, press
control-C (or control-Break) to terminate unzip.
Under DEC Ultrix, unzip will sometimes fail on long zipfiles
(bad CRC, not always reproducible). This is apparently due
either to a hardware bug (cache memory) or an operating sys-
tem bug (improper handling of page faults?).
Dates and times of stored directories are not restored.
[OS/2] Extended attributes for existing directories are
never updated. This is a limitation of the operating sys-
tem; unzip has no way to determine whether the stored attri-
butes are newer or older than the existing ones.
[VMS] When extracting to another directory, only the [.foo]
syntax is accepted for the -d option; the simple Unix foo
syntax is silently ignored (as is the less common VMS
foo.dir syntax).
[VMS] When the file being extracted already exists, unzip's
query only allows skipping, overwriting or renaming; there
should additionally be a choice for creating a new version
of the file. In fact, the ``overwrite'' choice does create
a new version; the old version is not overwritten or
deleted.
SEE ALSO
funzip(1L), zip(1L), zipcloak(1L), zipgrep(1L), zipinfo(1L),
zipnote(1L), zipsplit(1L)
AUTHORS
The primary Info-ZIP authors (current zip-bugs workgroup)
are: Jean-loup Gailly (Zip), Greg R. Roelofs (UnZip), Mark
Adler (decompression, fUnZip), Kai Uwe Rommel (OS/2), Igor
Mandrichenko (VMS), John Bush and Paul Kienitz (Amiga),
Antoine Verheijen (Macintosh), Chris Herborth (Atari), Henry
Gessau (NT), and Robert Heath (Windows). The author of the
original unzip code upon which Info-ZIP's is based was
Samuel H. Smith; Carl Mascott did the first Unix port; and
David P. Kirschbaum organized and led Info-ZIP in its early
days. The full list of contributors to UnZip has grown
quite large; please refer to the CONTRIBS file in the UnZip
source distribution for a more complete list.
VERSIONS
v1.2 15 Mar 89 Samuel H. Smith
v2.0 9 Sep 89 Samuel H. Smith
v2.x fall 1989 many Usenet contributors
v3.0 1 May 90 Info-ZIP (DPK, consolidator)
v3.1 15 Aug 90 Info-ZIP (DPK, consolidator)
v4.0 1 Dec 90 Info-ZIP (GRR, maintainer)
v4.1 12 May 91 Info-ZIP
v4.2 20 Mar 92 Info-ZIP (zip-bugs subgroup; GRR, maint.)
v5.0 21 Aug 92 Info-ZIP (zip-bugs subgroup; GRR, maint.)
v5.1 7 Feb 94 Info-ZIP (zip-bugs subgroup; GRR, maint.)
Info-ZIP Last change: 7 Feb 94 v5.1